package com.jt.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * @outhor fufeixiang
 * @date 2021-04-28
 */
@Component      //将对象交给Spring容器管理
//加载指定配置文件
@PropertySource(value = "classpath:/user.properties",encoding = "utf-8")
@Data           //data是lombok使用最多的 自动生成get/set/toString/equals/hashcode等方法
@Accessors(chain = true)        //重写set方法,返回this对象
@NoArgsConstructor      //无参构造
@AllArgsConstructor     //全参构造
public class User {
    @Value("${user.id}")
    private Integer id;
    @Value("${user.username}")
    private String username;
    @Value("${user.id2}")
    private Integer id2;
    @Value("${user.username2}")
    private String username2;
}
